using JT808Protocol.Common;
using JT808Protocol.Models.Enums;
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;

namespace JT808Protocol.Models.BodyParserStrategy.DeviceParams
{
    /// <summary>
    /// Can 总线参数
    /// </summary>
    public class DpCanSet_0x110 : IDeviceParam
    {
        public uint ParamID => 0x110;

        public byte Length => 8 + 5;

        public EnumDeviceParamType ParamType
        {
            get
            {
                try
                {
                    return (EnumDeviceParamType)ParamID;
                }
                catch (Exception)
                {
                    return EnumDeviceParamType.保留;
                }
            }
        }

        [JsonPropertyName("总线ID")] public string CanID { get; set; }

        public void ReadEntity(ref ReadOnlySpan<byte> source, ref int startIndex)
        {
            CanID = ParseHelper.AsciiString(ref source, startIndex + 5, 28);
        }

        public List<byte> WriteToNetBytes()
        {
            throw new NotImplementedException();
        }
    }
}